package com.domain;

import com.controller.ShootGame;

import java.awt.image.BufferedImage;

public class Bom extends Flying {

    /**
     *
     * @param x   爆炸x坐标
     * @param y    爆炸y坐标
     * @param width  爆炸图片的的宽
     * @param height    爆炸图片的高
     */
    public Bom(int x,int y,int width,int height) {
        setImage(ShootGame.bom1);//给图片属性赋值
        setWidth(getImage().getWidth());//给图片属性赋值
        setHeight(getImage().getHeight());//给图片的高赋值
        setX(x+((width-getWidth())/2));//爆炸效果的x坐标
        setY(y+((height-getHeight())/2));//爆炸效果的y坐标
        setImages(new BufferedImage[]{ShootGame.bom1, ShootGame.bom2, ShootGame.bom3, ShootGame.bom4});//使飞机移动喷气的图片
    }

    @Override
    public void move() {
        //爆炸效果
        setIndex(getIndex()+1);
        setImage(getImages()[getIndex()%4]);
    }

}
